<script type="text/javascript">
function sendFile() {
    var input, file;

    // (Can't use `typeof FileReader === "function"` because apparently
    // it comes back as "object" on some browsers. So just see if it's there
    // at all.)
    if (!window.FileReader) {
        bodyAppend("p", "The file API isn't supported on this browser yet.");
        return;
    }

    input = document.getElementById('fileinput');
    if (!input) {
        bodyAppend("p", "Um, couldn't find the fileinput element.");
    }
    else if (!input.files) {
        bodyAppend("p", "This browser doesn't seem to support the `files` property of file inputs.");
    }
    else if (!input.files[0]) {
        bodyAppend("p", "Please select a file before clicking 'Load'");
    }
    else {
        file = input.files[0];
        bodyAppend("p", "File " + file.name + " is " + file.size + " bytes in size");
        if(file.name.indexOf('.png') != 0 && file.size<=1000000){
        	document.fileattach.submit();
        }
    }
}
</script>
<FORM   METHOD="post" 
        ACTION="../uploadIcon"
        ENCTYPE="multipart/form-data"
        onsubmit="return Validate(this);"
        name="fileattach"> 
    Attachment: <INPUT id="fileinput" TYPE="file" NAME="attachedfile" MAXLENGTH=100 ALLOW="image/*" > 
    <!--button type="submit">Submit</button-->
    Название: <input type='text' name='iconName'><br>
    Тэги: <input type='text' name='iconTag'><br>
    <input type='button' id='btnLoad' value='Загрузить' onclick='sendFile();'>
</FORM>